package array;

import java.util.Random;

public class leetCode384_Solution {


    class Solution {

        int[] nums;
        int n;
        Random random = new Random();

        public Solution(int[] nums) {
            this.nums = nums;
            n = nums.length;
        }

        public int[] reset() {
            return nums;

        }

        public int[] shuffle() {
            int[] result = nums.clone();

            for (int i = 0; i < n; i++) {
                swap(result,i,i + random.nextInt(n - i));
            }
            return result;
        }
        public void swap(int[] arr,int i,int j){
            int tmp = arr[i];
            arr[i] = arr[j];
            arr[j] = tmp;
        }
    }
}